const get = 'get';
const post = 'post';
import Mock from 'mockjs'
import { prefix } from '@/api/api'

import moment from 'moment/moment';
Mock.mock(prefix+'/login',post,(req)=>{
       const customer= JSON.parse(req.body).customer
        return {
            data:{
                customer:{
                    id:Mock.mock('@id'),
                    name:customer.name,
                    nickname:Mock.mock('@ctitle(6)'),
                    password:Mock.mock('@word(32)')
                },
                account:{
                    ip:Mock.mock('@ip'),
                    token:Mock.mock('@word(16)'),
                    logintime:moment().format('yyyy-MM-dd HH:mm:ss')
                },
                code:200
            }
        }
})

Mock.mock(prefix+'/ifrememberLogin',post,(req)=>{
    const customer= JSON.parse(req.body).customer
    const account =JSON.parse(req.body).account
    // console.log(customer)
    return {
        data:{
            customer:{
                id:customer.id,
                name:customer.name,
                nickname:Mock.mock('@ctitle(6)'),
                password:Mock.mock('@word(32)')
            },
            account:{
                ip:account.ip,
                token:Mock.mock('@word(16)'),
                logintime:moment().format('yyyy-MM-dd HH:mm:ss')
            },
            code:200
        }
    }
})